<!--
 * @Author: xws 1043495328@qq.com
 * @Date: 2023-07-12 17:19:48
 * @LastEditors: xws 1043495328@qq.com
 * @LastEditTime: 2023-08-02 14:40:28
 * @FilePath: \vue3-admin-template\src\views\home\index.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <el-card>
    <div class="box">
      <img :src="userStore.avatar" alt="" class="avatar" />
      <div class="bottom">
        <h3 class="title">{{ getTime() }}好{{ userStore.username }}</h3>
        <p class="subtitle">{{ setting.title }}</p>
      </div>
    </div>
  </el-card>
  <div class="bg">
    <svg-icon name="welcome" width="600px" height="300px"></svg-icon>
  </div>
</template>

<script setup lang="ts">
//引入组合式API函数之生命周期函数
// import { onMounted } from 'vue'
//获取仓库
import useUserStore from '@/store/modules/user'
import setting from '@/setting'
import { getTime } from '@/utils/time'
import { ElNotification } from 'element-plus'
import { nextTick, onMounted, ref } from 'vue'
const userStore = useUserStore()
const nowTime = getTime()
onMounted(() => {
  let greeting = localStorage.getItem('thisMeaaage')
  // userStore.userInfo()
  if (greeting == '' || greeting == null || greeting == undefined) {
    ElNotification({
      type: 'success',
      message: '登录成功',
      title:
        'Hi,' +
        nowTime +
        '好！尊贵的昊天金阙无上至尊自然妙有弥罗至真至仁至强' +
        userStore.username +
        '用户',
    })
    localStorage.setItem('thisMeaaage', '0')
  }
})
</script>

<style scoped>
.box {
  display: flex;
  .avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
  }
  .bottom {
    margin-left: 20px;

    .title {
      font-size: 20px;
      font-weight: 900;
      margin: 20px 0px;
    }
    .subtitle {
      color: skyblue;
    }
  }
}
.bg {
  display: flex;
  justify-content: center;
}
/* ------------------------- */

</style>
